<template>
  <div class="Homepage">
    <div class="mint-header">
      <mt-button
        icon="back"
        @click="back()"
        class="headerback"
        v-touch:left="back"
        v-show="IsShow"
      >返回</mt-button>
      <mt-button
        icon=""
        class="headerback"
        v-touch:left="back"
        v-show="!IsShow"
      ></mt-button>
      <h1 class="headercenter">{{count}}</h1>
      <mt-button
        icon="icon-saoyisao"
        slot="right"
        class="headerright"
        @click="Scan"
        v-if="count == '设备违规登记'"
      >
        <i class="iconfont icon-saoyisao i"></i>
      </mt-button>
    </div>
    <div class="divHeght"></div>
    <router-view></router-view>
    <el-button type="danger" @click="logout" class="Logout">退出登录</el-button>
    <home-footer ref="mychild"></home-footer>
  </div>
</template>
<script>
import { mapState, mapMutations } from "vuex";
import Swiper from "swiper";
import HomeFooter from "../Footer";
export default {
  name: "HelloWorld",
  data() {
    return {
      IsShow: false
    };
  },
  components: {
    HomeFooter
  },
  created() {},
  computed: {
    count() {
      return this.$store.state.userInfo;
    }
  },
  mounted() {
    this.$refs.mychild.FooterUlliData("3");
    this.$store.commit("SET_USER_INFO", "我的");
  },
  watch: {
    $route(to, from) {
      if (to.path == "/Personainformation") {
        this.IsShow = false;
      } else {
        this.IsShow = true;
      }
    }
  },
  methods: {
    back() {
      this.$router.go(-1);
    },
    logout() {
      this.$store.dispatch("logout");
    },
    actionSheet: function() {
      // 打开action sheet
      this.sheetVisible = true;
    },
    getCamera: function() {
      console.log("打开照相机");
      this.$router.push({ name: "Scan" });
    },
    getLibrary: function() {
      console.log("打开相册");
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
.Logout {
  position: fixed;
  bottom: 1.5rem;
  left: 5.5%;
  width: 90%;
}
.v-enter-active,
.v-leave-active {
  transition: all 0.3s;
}
.v-enter,
.v-leave-to {
  transform: translateX(100%);
}
.mint-header {
  background-color: rgb(231, 203, 203);
  color: rgba(0, 0, 0, 0.521);
  position: fixed;
  right: 0;
  z-index: 999;
  width: 100%;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  background-color: #1785c6 !important;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  color: #fff;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  font-size: 14px;
  height: 40px;
  line-height: 1;
  padding: 0 10px;
  text-align: center;
  white-space: nowrap;
}
.Homepage .divHeght {
  height: 0.01rem;
}
.Homepage .Homeheader {
  height: 0.41rem;
}
.Homepage .headerback {
  width: 15%;
  text-align: left;
}
.Homepage .headercenter {
  width: 70%;
}
.Homepage .headerright {
  width: 15%;
  text-align: right;
}
.Homepage .i {
  font-size: 0.5rem;
  color: #f4ea2a;
}

.el-input__inner {
  font-size: 0.16rem;
  height: 0.5rem;
  padding: 0.3rem 0;
}
.mint-cell-title {
  flex: 0.8;
}
</style>
